﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Roles.aspx.cs" Inherits="entgp.Usuarios.Roles" %>

<%--<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>--%>
<%@ Register Src="wucRoles.ascx" TagName="wucRoles" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" DirectMethodNamespace="RolAjax"/>
    <script type="text/javascript" language="javascript">
        var EliminarRegistro = function () {
            Ext.MessageBox.show({
                title: "Eliminar Documento",
                msg: "Esta seguro de eliminar el item seleccionado?",
                buttons: Ext.MessageBox.OKCANCEL,
                fn: ConfirmDelDoc,
                icon: Ext.MessageBox.WARNING
            });
        };

        function ConfirmDelDoc(btn)
        {
            if(btn=='ok')
            {
                <%= GridPanelRoles.ClientID %>.deleteSelected();
             }
        };


    </script>
   
    <ext:Hidden ID="hidIdRol" runat="server"/>
    <ext:Store runat="server" ID="sEmpresas">
        <Reader>
            <ext:JsonReader IDProperty="Key">
                <Fields>
                    <ext:RecordField Name="Value"/>
                    <ext:RecordField Name="Key"/>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <ext:Store runat="server" ID="StoreRol" OnRefreshData="StoreRefresh" AutoLoad="false">
        <Reader>
            <ext:JsonReader IDProperty="Id">
                <Fields>
                    <ext:RecordField Name="Id" />
                    <ext:RecordField Name="Nombre" />
                    <ext:RecordField Name="Descripcion" />
                    <ext:RecordField Name="Codigo" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Proxy>
            <ext:PageProxy></ext:PageProxy>
        </Proxy>
        <BaseParams>
			<ext:Parameter Name="txtDescripcion_bprm" Value="#{txtDescripcion}.getValue()"   Mode="Raw" />
			<ext:Parameter Name="txtNombreRol_bprm" Value="#{txtNombreRol}.getValue()"   Mode="Raw" />	
          	
		</BaseParams>

    </ext:Store>
    <ext:Panel ID="Panel1" BodyStyle="padding:15px;background-color:#E7E4DD;" runat="server"
        AutoHeight="true">
        <Items>
            <ext:Panel ID="Panel2" Height="90" runat="server" BodyStyle="background-color:Transparent;" ButtonAlign="Center"
                Layout="Column">
                <Items>
                    <ext:Panel ID="Panel3" runat="server" Border="false" Header="false" BodyStyle="padding:10px;background-color:Transparent;"
                        ColumnWidth="0.5" Layout="Form">
                        <Items>
                            <ext:TextField FieldLabel="Nombre" ID="txtNombreRol" runat="server" AnchorHorizontal="95%" />
                        </Items>
                    </ext:Panel>
                    <ext:Panel ID="Panel4" runat="server" Border="false" BodyStyle="padding:10px;background-color:Transparent;"
                        ColumnWidth="0.5" Layout="Form">
                        <Items>
                            <ext:TextField FieldLabel="Descripción" ID="txtDescripcion" runat="server" AnchorHorizontal="95%" />
                        </Items>
                    </ext:Panel>
                </Items>
                <Buttons>
                    <ext:Button runat="server" ID="btnBuscar" Text="Buscar" Icon="Find">
                        <%--
                        <DirectEvents>
                            <Click OnEvent="btnBuscar_Click">
                                <EventMask ShowMask="true" />
                            </Click>
                        </DirectEvents>
                         --%>
                        <Listeners>
                          <Click Handler="#{StoreRol}.load();" />
                        </Listeners>

                    </ext:Button>
                </Buttons>
            </ext:Panel>
        </Items>
    </ext:Panel>
    <ext:GridPanel ID="GridPanelRoles" runat="server" StoreID="StoreRol" StripeRows="true"
        AutoWidth="true" AutoHeight="true" Title="Listado de Roles">
        <TopBar>
            <ext:Toolbar runat="server">
                <Items>
                    <ext:Button runat="server" ID="btnNuevo" Text="Nuevo" Icon="Add">
                        <DirectEvents>
                            <Click OnEvent="btnNuevo_Click">
                                <ExtraParams>
                                    <ext:Parameter Name="Operacion" Value="Nuevo" Mode="Value">
                                    </ext:Parameter>
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                    <ext:ToolbarFill ID="ToolbarFill1" runat="server" />
                    <ext:Label ID="lblNewSeeK" runat="server" Icon="ArrowRefresh" />
                    <ext:ComboBox ID="cbxChoseeEmp" runat="server" FieldLabel="Empresas" AllowBlank="false"
                        StoreID="sEmpresas" DisplayField="Value" ValueField="Key" Editable="false">
                    </ext:ComboBox>
                    <ext:Button runat="server" ID="btnNuevaBusqueda" Text="Aceptar">
                        <DirectEvents>
                            <Click OnEvent="btnNewSeeK_Click">
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                </Items>
            </ext:Toolbar>
        </TopBar>
        <ColumnModel ID="ColumnModel1" runat="server">
            <Columns>
                <ext:CommandColumn Width="70">
                    <Commands>
                        <ext:GridCommand CommandName="Editar"  Icon="ApplicationEdit" ToolTip-Text="Editar datos del rol"/>
                        <ext:GridCommand CommandName="Eliminar"  Icon="PageDelete" ToolTip-Text="Eliminar item"/>
                    </Commands>
                </ext:CommandColumn>
                <ext:Column ColumnID="Nombre" Header="Nombre" Width="200" Sortable="true" DataIndex="Nombre" />
                <ext:Column Header="Descrición" Sortable="true" DataIndex="Descripcion"  Width="250"/>
               
            </Columns>
        </ColumnModel>
        <DirectEvents>
            <Command OnEvent="command_Click">
                <ExtraParams>
                    <ext:Parameter Name="Operacion" Value="command" Mode="Raw" Encode="False" />
                    <ext:Parameter Name="Id" Value="record.data.Id" Mode="Raw" />
                </ExtraParams>
            </Command>
        </DirectEvents>
        <SelectionModel>
            <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true"/>
        </SelectionModel>
    </ext:GridPanel>
    <uc1:wucRoles runat="server" ID="wucRoles1" />
    <ext:Window ID="wSelectEmpresa" runat="server" Icon="Application" Title="Escojer Empresa"
        Modal="True" AutoHeight="true" CenterOnLoad="true" Hidden="true" ButtonAlign="Center"
        Width="300" Height="150">
        <Items>
            <ext:Panel ID="Panel5" runat="server" Border="false" Header="false" BodyStyle="padding:15px;background-color:Transparent;" Layout="Form">
                <Items>
                    <ext:ComboBox ID="cbxEmpresas" runat="server" FieldLabel="Empresas" AllowBlank="false"
                        AnchorHorizontal="100%" StoreID="sEmpresas" DisplayField="Value" ValueField="Key"
                        Editable="false">
                        <Listeners>
                        </Listeners>
                    </ext:ComboBox>
                </Items>
            </ext:Panel>
        </Items>
        <Buttons>
            <ext:Button runat="server" ID="Button1" Text="Aceptar" Icon="Add">
                <DirectEvents>
                    <Click OnEvent="btnSelecionar_Click">
                    </Click>
                </DirectEvents>
            </ext:Button>
            <ext:Button runat="server" ID="Button2" Text="Cancelar" Icon="Stop">
                <Listeners>
                    <Click Handler="var TabPanel = window.parent.Ext.getCmp('NavegacionTabs');TabPanel.remove(TabPanel.activeTab, true);" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>
    </form>
</body>
</html>
